$(function () {
    $('#password_confirm').change(function () {
    //    验证两次输入的密码是否一致
        var password = $('#password').val();
        var password_confirm = $(this).val();
        if(password == password_confirm){
            $('#password_confirm_info').html('密码一致').css('color', 'green');
        }else{
            $('#password_confirm_info').html('两次输入密码不一致').css('color', 'red');
        }
    });
    $('#username').blur(function () {
        var username = $(this).val()
        $.getJSON('/axf/checkname/', {'username': username}, function (data) {
            if(data['status'] == 200){
                $('#username_info').html(data['desc']).css('color', 'green');
            }else{
                $('#username_info').html(data['desc']).css('color', 'red');
            }
        } )
    })
});

function check_input(){
    var password = $('#password').val();
    var password_confirm = $('#password_confirm').val();
    if(password == password_confirm && password.length >= 3){
        password = md5(password);
        console.log(password);
        $('#password').val(password);
        $('#password_confirm').val(password);
        return true
    }else{
        return false
    }
}